package ru.linnenson.darshana.infrastructure.rest.mappers;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import ru.linnenson.darshana.application.domain.physic.PhysicTask;
import ru.linnenson.darshana.infrastructure.persistence.models.PhysicTaskStore;
import ru.linnenson.darshana.infrastructure.rest.dto.PhysicTaskDto;
import java.util.List;

@Mapper(componentModel = "spring")
public interface PhysicTasksMapper {

  List<PhysicTaskDto> toDto(final List<PhysicTaskStore> tasks);

  @Mapping(
      target = "withSolution",
      expression = "java(task.getSolutionPhotoIds() != null && !task.getSolutionPhotoIds().isEmpty())"
  )
  PhysicTaskDto toDto(final PhysicTaskStore task);
}
